Optimising Embedded DSLs Using Template Haskell
نویسندگان
چکیده
Embedded domain specific languages (EDSLs) provide a specialised language for a particular application area while harnessing the infrastructure of an existing general purpose programming language. The reduction in implementation costs that results from this approach comes at a price: the EDSL often compiles to inefficient code since the host language’s compiler only optimises at the level of host language constructs. The paper presents an approach to solving this problem based on compile-time meta-programming which retains the simplicity of the embedded approach. We use PanTHeon, our implementation of an existing EDSL for image synthesis to demonstrate the benefits and drawbacks of this approach. Furthermore, we suggest potential improvements to Template Haskell, the meta-programming framework we are using, which would greatly improve its applicability to this kind of task.
منابع مشابه
An Editor in Haskell for Haskell
Yi is a text editor written in Haskell and extensible in Haskell. We take advantage of Haskell’s expressive power to define embedded DSLs that form the foundation of the editor. In turn, these DSLs provide a flexible mechanism to create extended versions of the editor. Yi also provides some support for editing Haskell code.
متن کاملOptimising Embedded Domain Specific Languages
(Embedded) Domain Specific Languages (eDSL) are becoming a significant part of our programming challenges. Many programming languages have to interface with SQL, HTML, etc. A specific area of research are parser combinator libraries like Parsec (written in Haskell), which unlike parser generators, are barely optimised. This paper offers a solution to optimise a dialect of Parsec and demonstrate...
متن کاملImplementing Explicit and Finding Implicit Sharing in Embedded DSLs
Aliasing, or sharing, is prominent in many domains, denoting that two differently-named objects are in fact identical: a change in one object (memory cell, circuit terminal, disk block) is instantly reflected in the other. Languages for modelling such domains should let the programmer explicitly define the sharing among objects or expressions. A DSL compiler may find other identical expressions...
متن کاملDSL Implementation in MetaOCaml, Template Haskell, and C++
A wide range of domain-specific languages (DSLs) has been implemented successfully by embedding them in general purpose languages. This paper reviews embedding, and summarizes how two alternative techniques—staged interpreters and templates—can be used to overcome the limitations of embedding. Both techniques involve a form of generative programming. The paper reviews and compares three program...
متن کاملNettle: Functional Reactive Programming for OpenFlow Networks
We describe a language-centric approach to solving the complex, low-level, and error-prone nature of network control. Specifically, we have designed a domain-specific language called Nettle, embedded in Haskell, that allows programming OpenFlow networks in an elegant, declarative style. Nettle is designed in layers to accommodate a family of DSLs targeted for specific network applications. The ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2004